<!DOCTYPE html>
<html>

        <title>blur(失去焦点)、focus（得到焦点）事件</title>
        <meta charset="utf-8">
        <body>
            请输入用户名:<input type="text" onfocus="test1()" onblur="test2()">
        </body>
        <script>
              function test1(){
                  alert("得到焦点")
              }

              function test2(){
                  alert("失去焦点")
              }
        </script>
   
</html>